<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class TaskProcess extends Model
{
    protected $table = 'task_process';
    protected $guarded = ['id'];

    public function worker()
    {
    	return $this->belongsTo(User::class,'worker_id','id');
    }

    public function task()
    {
    	return $this->belongsTo(Task::class);
    }

    public function getStatusTxtAttribute()
    {
        $status_arr['1']   = '待处理';
        $status_arr['50']  = '处理中';
        $status_arr['100'] = '已处理';
        return $status_arr[$this->status];
    }

    public function getStatusStyleAttribute()
    {
        //dd($this->status);
        $status_arr['1']   = 'default';
        $status_arr['50']  = 'primary';
        $status_arr['100'] = 'success';
        return $status_arr[$this->status];
    }
}
